#pragma once

#include <opencv2/opencv.hpp>
#include <iostream>
#include <filesystem>
#include <queue>
#include <cmath>
#include <fstream>

namespace fs = std::filesystem;

// 全局常量声明
extern const int whiteBlockWidth;
extern const int sideSize;
extern const int squareSize; 
extern const int blockSize;
extern const int dataBegin;
extern const int dataSize;

// 全局变量声明
extern double rowWidth;
extern double colWidth;
extern double rowoffset;
extern double coloffset;
extern bool error_row[42];
extern bool error_col[42];
extern std::queue<short> indata;

// 函数声明
int getfilenum(const std::string& folderpath);
int getcolor(cv::Mat& image, int row, int column);
int getno(cv::Mat& image);
int getsize(cv::Mat& image);
void getdata(cv::Mat& image, short data[]);
void getcode(cv::Mat& image, short code[]);
bool check(short data[], short code[]);
void writetobin(const std::string& binpath);
unsigned char bit2byte();
void img2bin(const std::string& binpath); 